import { DD_SYSTEM } from '@/constants/api-pre';
import { request } from '../request';

/** get constant routes */
export function fetchGetConstantRoutes() {
  return request<Api.Route.MenuRoute[]>({ url: `${DD_SYSTEM}/menus/routes/constant` });
}

/** get user routes */
export function fetchGetUserRoutes() {
  return request<Api.Route.UserRoute>({ url: `${DD_SYSTEM}/menus/routes` });
}

/**
 * whether the route is exist
 *
 * @param routeName route name
 */
export function fetchIsRouteExist(routeName: string) {
  return request<boolean>({ url: `${DD_SYSTEM}/menus/route/exist/${routeName}` });
}
